import list from '@/mixins/list'

export default {
    mixins: [list],
    data() {
        return {
            //     @ApiModelProperty(value = "场馆类型编号：ty-体育 zr-真人 dj-电竞 qp-棋牌 cp-彩票 by-捕鱼 dy-电子 dz-德州 qkl-区块链")
            venue: [
                {
                    type: 'ty',
                    label: '体育'
                },
                {
                    type: 'dj',
                    label: '电竞'
                },
                {
                    type: 'qp',
                    label: '棋牌'
                },
                {
                    type: 'cp',
                    label: '彩票'
                },
                {
                    type: 'dy',
                    label: '电子'
                },
                {
                    type: 'zr',
                    label: '真人'
                },
                {
                    type: 'total',
                    label: '总计'
                }
            ]
        }
    },
    methods: {
        updateData(newVal, property) {
            this.$emit('update:data', {
                ...this.data,
                [property]: newVal
            })
        },
        checkNums (nums) {
            let f = true
            for (let i = 0; i < nums.length; i++) {
                if (typeof nums[i] !== 'number') {
                    f = false
                }
            }

            return f
        },

        aomunt(num) {
            return this.handleNumber('USDT', num)
        },
        calculateTotal(nums) {
            if (!this.checkNums(nums)) {
                return 0
            }
            return nums.reduce((a, b) => a + b)
        },

        // 处理场馆返点 data
        formatVenueData(proxyTeamBillDetail) {
            return this.venue.map((item) => {
                return {
                    ...item,
                    ...this.data,
                    __prefix: item.type
                }
            })
        }

    }
}
